home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_vol_lekk_door.cog < prev    next >
Text File  |  1999-11-15  |  10KB  |  377 lines

  1. # Jones 3D Cog Script
  2. #
  3. # VOL_Lekk_Door.cog
  4. #
  5. # This cog will open a door upon whipping the Lekk arm.
  6. #
  7. # [CM & RT & HB]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ==============================================================================
  11.  
  12. symbols
  13.  
  14. #.......................... MESSAGES .....................
  15.     message        startup
  16.     message        damaged
  17.     message        callback
  18.     message        pulse
  19.     message        entered
  20.  
  21. #.......................... ACTORS .......................
  22.     thing        player                                local
  23.     thing        indyActor                            
  24.  
  25. #.......................... ACTOR MARKS ..................
  26.     thing        endscene_mv                            nolink
  27.  
  28. #.......................... PROPS ........................
  29.     thing        Lekkanimarm
  30.     thing        Lekkstrut
  31.     thing        Lekk                                nolink
  32.     thing        door                                nolink
  33.     thing        indy
  34.     thing        doorSector                            local
  35.     surface        doorfloorSURF                        
  36.  
  37. #.......................... CAMERAS ......................
  38.     thing        cam1                                nolink
  39.     thing        cam2                                nolink
  40.     thing        cam3                                nolink
  41.     
  42.     thing        spotCam                                nolink    # camera for indy spotting the arm for the first time
  43.     
  44.     thing        camrestorepos                        nolink
  45.  
  46.     thing        cam1spot                            local
  47.  
  48. #.......................... CAMERA TARGETS ...............
  49.     thing        camtarget1                            nolink
  50.     thing        camtarget2                            nolink
  51.     thing        camtarget3                            nolink
  52.  
  53.     thing        spotTarg                            local
  54.     thing        cam1look                            local
  55.  
  56. #.......................... TRIGGERS .....................
  57.     surface        whipSurf                            nolink
  58.     
  59.     sector        spotSECT0                            linkID=2
  60.     sector        spotSECT1                           linkID=2
  61.     sector        spotSECT2                           linkID=2
  62.  
  63. #.......................... KEYFRAMES ....................
  64.     keyframe    in_whipit=in_whip_outprobe.key        local
  65.     keyframe    wh_whipit=WH_whip_outprobe.key        local
  66.     keyframe    armswing=vol_whip_arm.key            local
  67.     
  68.     keyframe    in_hat=0in_figithat_4_4.key            local
  69.     keyframe    in_brush=0in_stand1_bd_4.key        local
  70.     keyframe    in_stand4=0in_stand4.key            local
  71.  
  72. #.......................... MODELS .......................
  73.     model        whipHand=weap_whip.3do                local
  74.  
  75. #.......................... SOUNDS .......................
  76.     sound        arm_start=nub_stonedoor_start_c.wav    local
  77.     sound        arm_move=nub_2mstep_move_c.wav        local
  78.     sound        arm_stop=nub_sarc_jewel_turn_c.wav    local
  79.     
  80.     sound        statue_move=nub_bull_move1_c.wav    local
  81.     sound        statue_stop=nub_3mledge_stop_c.wav    local
  82.     sound        success_cue=mus_shw_meltice.wav        local
  83.     
  84.     sound        in_spotarm=INXJ001.wav                local    # "huh. ...interesting..."
  85.  
  86.     sound        strike=gen_whip_fire.wav            local    # whip crack sound
  87.  
  88. #.......................... TEMPLATES ....................
  89.     template    whipTpl=+whip_actor                    local
  90.     template    ghostTpl=ghost                        local
  91.  
  92. #.......................... VARIABLES ....................
  93.     thing        whipThing                            local
  94.  
  95.     sector        camsector                            local
  96.  
  97.     vector        v_camspot                            local
  98.  
  99.     flex        rotref                                local
  100.  
  101.     int            open=0                                local
  102.     int            curCam                                local
  103.     int            curSound                            local
  104.     int            indyAnim                            local
  105.     int            whipAnim                            local
  106.     int            clue=0                                local
  107.     int            track                                local
  108.  
  109. end
  110.  
  111. # ==============================================================================
  112. code
  113.  
  114. startup:
  115.  
  116.     player = GetLocalPlayerThing();
  117.     
  118.     doorSector = GetThingSector(door);
  119.     SetSectorAdjoins(doorSector, 0);
  120.  
  121.     # hide the animating arm for cutscene
  122.     SetThingFlags(Lekkanimarm, 0x80000);
  123.  
  124.     # doorfloorSURF is a move adjoin
  125.     SetAdjoinFlags(doorfloorSURF, 2);
  126.     SetAdjoinFlags(GetSurfaceAdjoin(doorfloorSURF), 2);
  127.  
  128.     return;
  129.  
  130. # ==============================================================================
  131. damaged:    # If player hits the arm
  132.  
  133.     if (open != 0) return;
  134.  
  135.     if (GetSenderRef() == Lekkstrut)
  136.     {
  137.         open = 1;
  138.         
  139.         # prep the indy actor
  140.         ResetCameraFOV(0, 0);
  141.         curCam = GetCurrentCamera();
  142.         SetActorFlags(player, 0x200000);
  143.         StopThing(player);
  144.  
  145.         # prep the camera
  146.         #SetExtCamOffsetToThing(cam1);
  147.         #SetExtCamLookOffsetToThing(camtarget1);
  148.         #Sleep(2.0);
  149.  
  150.         # play music
  151.         PlaySoundLocal(success_cue, 1.0, 0.0, 0x0, 0);
  152.  
  153.         SetCameraSecondaryFocus(2, camtarget1);
  154.         SetCameraFocus(2, cam1);
  155.         SetCameraLookInterp(2, 0);
  156.         Sleep(0.01);
  157.         SetCurrentCamera(2);
  158.         SetCameraFOV(100, 0, 0);
  159.         Sleep(0.01);
  160.         SetCameraFOV(80, 1, 2.0);
  161.  
  162.         # prep indy 
  163.         #CopyOrientAndPos(player, indy);
  164.         CopyPlayerHolsters(player, indy); # make sure actor has matching props
  165.         ClearThingFlags(indy, 0x80000);
  166.         SetThingFlags(player, 0x80000);
  167.         AISetLookThing(indy, Lekkstrut); 
  168.  
  169.         StartCutScene(1);
  170.  
  171.         # Prep whip
  172.         whipThing = AttachThingToThingMesh(indy, whipTpl, 15);
  173.         SetThingMesh(indy, 15, whipHand, 0);
  174.  
  175.         # Do that whip swing thang...
  176.         indyAnim = PlayKey(indy, in_whipit, 5, 0x14, 0);        # Indy anim...
  177.         whipAnim = PlayKey(whipThing, wh_whipit, 5, 0x14, 0);    # Whip anim...
  178.  
  179.         # clear collision on the door
  180.         SetCollideType(door, 0);
  181.     }
  182.     return;
  183.  
  184. # ==============================================================================
  185. callback:
  186.  
  187.     if (GetSenderRef() != indy) return;
  188.  
  189.     if (GetParam(1) == 23)
  190.     {
  191.         PlaySoundLocal(strike, 1.0, 0.0, 0x0, 0);
  192.         
  193.         # Stop animations
  194.         StopKey(indy, indyAnim, 0);
  195.         StopKey(whipThing, whipAnim, 0);
  196.  
  197.  
  198.         # Close shot of the arm...
  199.         SetCameraSecondaryFocus(2, camtarget2);
  200.         SetCameraFocus(2, cam2);
  201.         
  202.         # hide indy actor
  203.         SetThingFlags(indy, 0x80000);
  204.         
  205.         # swap in correct arm model     and animate it
  206.         SetThingFlags(Lekkstrut, 0x10);
  207.         ClearThingFlags(Lekkanimarm, 0x80000);
  208.         SetPulse(0.1);    # some screenshake
  209.         
  210.         ResetCameraFOV(0, 0);
  211.         Sleep(0.01);
  212.         SetCameraFOV(80, 1, 2.0);
  213.  
  214.         # Restore the whip
  215.         DetachThingMesh(whipThing);
  216.         SetWeaponModel(indy, 2);
  217.         
  218.         PlayKey(Lekkanimarm, armswing, 4, 0x14, 0);
  219.         # arm move sounds
  220.         PlaySoundLocal(arm_start, 1, 0, 0x0,0);
  221.         curSound = PlaySoundLocal(arm_move, 1, 0, 0x1,0);
  222.  
  223.         # stop the arm sfx
  224.         Sleep(1.5);
  225.         StopSound(curSound, 0.0);
  226.         SetPulse(0);
  227.         PlaySoundlocal(arm_stop, 1, 0, 0x0,0);
  228.         Sleep(1.5);
  229.                                             
  230.         # hide  lekkanimarm
  231.         SetThingFlags(Lekkanimarm, 0x80000);
  232.         ClearThingFlags(Lekkstrut, 0x10);
  233.         
  234.         # new camera looks from rotating statue down to opening door
  235.         SetCameraSecondaryFocus(2, camtarget3);
  236.         SetCameraFocus(2, cam3);
  237.         ResetCameraFOV(0, 0);
  238.         SetCameraFOV(80, 1, 2.0);
  239.         #SetPulse(0.1);
  240.         SetSectorAdjoins(doorSector, 1);
  241.         
  242.         # open door, move camtarget, move camera
  243.         MoveToFrame(door, 1, 1.5);
  244.         SetPulse(0.1);
  245.  
  246.         # actor watches
  247.         AISetLookThing(indy, door);
  248.         WaitForStop(door);
  249.         SetPulse(0);
  250.  
  251.         # doorfloorSURF becomes no move adjoin
  252.         ClearAdjoinFlags(doorfloorSURF, 2);
  253.         ClearAdjoinFlags(GetSurfaceAdjoin(doorfloorSURF), 2);
  254.         
  255.             Sleep(1.0);
  256.         SetThingFlags(indy, 0x80000);
  257.         ClearThingFlags(player, 0x80000);
  258.         
  259.         # restore the camera
  260.         TeleportThing(player, endscene_mv);
  261.         JumpToFrame(Lekkstrut, 1, GetThingSector(Lekkstrut));
  262.  
  263.         SetCameraPosition(1, GetThingPos(camrestorepos));
  264.         SetCurrentCamera(1);
  265.         SetCameraFOV(90, 0, 0);
  266.  
  267.         # Clear whip surface flags -- no more aiming
  268.         ClearSurfaceFlags(whipSurf, 0x10000000);
  269.         
  270.         # Clear Whipable flags from lekkstrut
  271.         ClearThingFlags(Lekkstrut, 0x80000000);
  272.         ClearThingFlags(Lekkstrut, 0x8);
  273.  
  274.         # Set AF_NOTARGET flag
  275.         SetActorFlags(Lekkstrut, 0x100000);
  276.         
  277.         ClearActorFlags(player, 0x200000);
  278.         ClearThingFlags(player, 0x80000);
  279.         EndCutScene();
  280.     }
  281.     return;
  282.  
  283. # ==============================================================================
  284. pulse:
  285.  
  286.     SetPOVShake('0.0 0.0 0.005', '0.0 0.0 0.005', 80.0, 0.80);
  287.     return;
  288.  
  289. # ==============================================================================
  290. entered:
  291.  
  292.     If ((GetSenderID() != 2) && (GetSourceRef() != player)) return;
  293.     If (clue != 0) return;
  294.     
  295.     clue = 1;
  296.  
  297.     # Prep...
  298.     MakeMeStop();
  299.     DeselectWeaponWait(player);
  300.     StartCutScene(1);
  301.     CopyPlayerHolsters(player, indyActor);
  302.     TeleportThing(indyactor, player);
  303.     SetThingFlags(player, 0x80000);
  304.     ClearThingFlags(indyActor, 0x80000);
  305.     AISetCutSceneMode(indyActor);
  306.  
  307.     # set rotvel and actor look at statue
  308.     rotref=(GetThingMaxRotVel(indyActor));
  309.     SetThingMaxRotVel(indyActor, 150);
  310.     AISetLookThing(indyActor, Lekk);
  311.  
  312.     # Make target...
  313.     v_camspot = VectorAdd(VectorTransformToOrient(player, '0.0 0.03 0.0'), GetThingPos(player));
  314.     camsector = FindNewSectorFromThing(player, v_camspot);
  315.     spotTarg = CreateThingAtPos(ghostTpl, camsector, v_camspot, '0 0 0');
  316.     CaptureThing(spotTarg);
  317.  
  318.     # Slew cam aside...
  319.     cam1spot = CreateThing(ghostTpl, player);
  320.     CaptureThing(cam1spot);
  321.     cam1look = CreateThing(ghostTpl, player);
  322.     CaptureThing(cam1look);
  323.     MakeCamera2LikeCamera1(cam1spot, cam1look);
  324.     SetCameraLookInterp(2, 0);
  325.     SetCameraPosInterp(2, 0);
  326.     SetCameraFocus(2, cam1spot);
  327.     SetCameraSecondaryFocus(2, cam1look);
  328.     SetCurrentCamera(2);
  329.     ResetCameraFOV(0, 0.0);
  330.     SetCameraLookInterp(2, 1);
  331.     SetCameraPosInterp(2, 1);
  332.     SetCameraInterpSpeed(2, 1.0);
  333.     Sleep(0.01);
  334.  
  335.     SetCameraFocus(2, spotCam);
  336.     SetCameraSecondaryFocus(2, spotTarg);
  337.     SetCameraFOV(60, 1, 1.0);
  338.  
  339.     # play indy's anims and voice line
  340.     track = PlayKey(indyActor, in_Stand4, 2, 0x0, 0);
  341.     PlayKey(indyActor, in_brush, 4, 0x12, 1); # 26x
  342.  
  343.     PlayVoice(indyActor, in_spotarm, 1.0, 0);
  344.     PlayKey(indyActor, in_hat, 4, 0x12, 0);
  345.     Sleep(1.0);
  346.  
  347.     # move camera focus object up to strut
  348.     SetCameraInterpSpeed(2, 3.5);
  349.     Sleep(0.1);
  350.     
  351.     SetCameraSecondaryFocus(2, Lekkstrut);
  352.     SetCameraFOV(25, 1, 3.5);
  353.     Sleep(4.5);
  354.  
  355.     # put the player at actors' position, clear actor, show player
  356.     TeleportThing(player, indyactor);
  357.     AIClearCutSceneMode(indyActor);
  358.     ClearThingFlags(player, 0x80000);
  359.     StopKey(indyActor, track, 0);
  360.     SetThingFlags(indyActor, 0x80000);
  361.  
  362.     # Restore the cam, end the scene
  363.     SetCameraPosition(curCam, GetThingPos(spotCam));
  364.     SetCameraLookInterp(2, 0);
  365.     SetCameraPosInterp(2, 0);
  366.     SetCurrentCamera(1);
  367.     ResetCameraFOV(0, 0.0);
  368.     EndCutScene();
  369.     ClearActorFlags(player, 0x200000);
  370.  
  371. return;
  372.     
  373. end
  374.  
  375.  
  376.  
  377.